package com.taru.wxhsh.service.impl;

import com.taru.wxhsh.mapper.CategoryMapper;
import com.taru.wxhsh.pojo.Category;
import com.taru.wxhsh.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by HuKang on 2018/5/30.
 */
@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    CategoryMapper categoryMapper;

    @Override
    public List<Category> qryList() {
        return categoryMapper.qryList();
    }

    @Override
    public int deleteByPrimaryKey(String categoryId) {
        return categoryMapper.deleteByPrimaryKey(categoryId);
    }

    @Override
    public int insertSelective(Category record) {
        return categoryMapper.insertSelective(record);
    }

    @Override
    public int upByPrimaryKey(String categoryId){return categoryMapper.upByPrimaryKey(categoryId);}

    @Override
    public int downByPrimaryKey(String categoryId){return categoryMapper.downByPrimaryKey(categoryId);}


    /**
     * 修改全部信息
     * @param category
     * @return
     */
    @Override
    public int updateCategory(Category category) {
        return categoryMapper.updateByPrimaryKeySelective(category);
    }

    /**
     * 查询类别信息
     * @param categoryId
     * @return
     */
    @Override
    public Category selectById(String categoryId) {
        return categoryMapper.selectByPrimaryKey(categoryId);
    }
}
